1. Field of the Invention
The present invention relates to a method for automatically designing a program structure. More specifically, the present invention relates to a method for automatically designing a structure of a program represented by a procedural programming language from a program specification described by a nonprocedural program specification description language by utilizing a computer.
2. Description of the Background Art
A problem called structure clashes between input/output data occurs in design of program structure. This problem also means that synchronization can not be attained in flow of calculation execution timing. This problem is pointed out in "Principles of Program Design" by M. A. Jackson, p. 299, Academic Press, London (1975) (Japanese Translation by Koji Torii, p. 318, issued by Japan Computer Institute, Tokyo (1980)). Conventionally, this problem has been dealt with by the following three methods.
(1) After a programmer detects structure clashes and solves them, he describes a program specification by a nonprocedural program specification description language from the result of the solution. Consequently, when a structure of a program represented by a procedural programming language is automatically designed from the program specification, detection and solution of structure clashes are not required.
(2) A programmer describes a program specification without being aware of structure clashes, namely, without detecting and solving the structure clashes. In addition, detection of structure clashes is not effected at the time of automatically designing a program structure represented by a procedural programming language from the program specification, and a program structure is automatically designed on the assumption that structure clashes always exist.
(3) The programmer describes a program specification without being aware of structure clashes, using a nonprocedural MODEL language characterized by having functions applicable to arrays and array elements. Consequently, at the time of automatically designing a structure of a program represented by a procedural programming language from the program specification, structure clashes are detected and solved.
The MODEL language is described by N. S. Prywes, A. Pnueli in "Compilation of Nonprocedural Specifications into Computer Programs", IEEE Trans. Softw. Eng., Vol. SE-9, No. 3, pp.267-279 (1983).
According to Japanese Patent Laying-Open No. 63-14240 (filed May 29, 1987) entitled "Method for Converting Computer Program Codes" (counterpart U.S. patent application Ser. No. 882737), there is disclosed a method for automatically generating a program represented by a procedural programming language from a nonprocedural language characterized by having functions applicable to arrays and array elements; however, this method does not include automatically detecting and solving structure clashes.
Structure clashes of input/output data are originally problems occurring at the time of designing a program structure. Thus, the structure clashes are problems related with design of program structure and it should not be taken into account in a program specification for representing program functions. Therefore, program specifications taking account of structure clashes and requiring a programmer to be conscious of such clashes cause obstruction to easiness of description and understanding of program specifications. The method described in (1) above involves such factors of obstruction and therefore involves a problem.
If structure clashes exist and they can not be solved by sorting of input data, it is necessary to solve the structure clashes using areas capable of storing many data defined in a main storage or a secondary storage of a computer. More specifically, it is necessary to synchronize flows of timing by waiting attained by temporarily storing many data into array variables defined in the main storage, and files or data bases defined on the secondary storage.
On the other hand, if no structure clash exists, array variables, files or data bases are not required and the data can be processed by using scalar variables defined in the main storage. As a matter of course, the program execution efficiency in the case of processing data using scalar variables is better than that in the case of processing data using array variables, files or data bases. Consequently, in order to enhance the program execution efficiency, it is necessary to detect a portion where a structure clash exists, to assign an area capable of storing many data defined in the main storage or secondary storage for only that portion, and to assign a scalar variable in the main storage for the other portions where no structure clash exists.
However, according to the above described method of (2), the areas capable of storing many data defined in the main or secondary storage are assigned to the portions to which the scalar variables in the main storage are applicable, and consequently the method of (2) involves a problem in program execution efficiency.
According to the above described method of (3), at the time of automatically designing a program structure represented by a procedural programming language from a program specification, structure clashes are detected and solved. However, the detection and solution are made by using characteristics of arrays of the nonprocedural MODEL language and since sets and mappings are more abstract concepts than the arrays, the above mentioned method is not applicable to detection and solution of structure clashes mappings using the characteristics of sets and mappings.
With regard to program input/output data, it has a data format and at the same time it represents information. The information is defined by a universe of discourse to be processed by a program, while the data format is defined by taking account of not only the information but also the processing efficiency of the program. Thus, since the information and the data format are defined by different factors, it is necessary to classify program specifications for the information and the data format and to describe the program specifications by a method suited for each of the information and the data format, thereby making it easy to describe and understand the program specification.
As for the data format, it is suited for description by a description method including arrays as descriptive elements but as for the information, it is necessary to describe it by descriptive elements having the characteristics of sets and mappings capable of representing a universe of discourse as it is recognized. However, the language mentioned in (3) above does not have descriptive elements having characteristics of sets and mappings and accordingly, there is a problem in attaining easy description and easy understanding of program specifications.